<?php

//require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Framework.php';
require_once('TVB/pms/pdes/action/LoginAction.class.php');
require_once('TVB/pms/pdes/util/functions.php');

class ChapterDelActionTest extends PHPUnit_Framework_TestCase
{

	protected function setUp()
	{
		$this->url = "http://pdes.tvb.com/del_chapter.html?ut=true";
	}

	protected function tearDown()
	{
		$this->url = NULL;
	}

	public function testSuccess(){

		$success_data = array(

			//-- add record{{{
			"id"=>1,
			//}}}
		);

		$ret = curl_test($this->url,$success_data);
		$real_data = json_decode($ret);
		$err_num = count($real_data);
		if ($err_num == 0)
		{
			echo "ChapterDelActionTest pass!<br>";
		}

		$this->assertEquals($err_num, 0); 	
	}

	public function testFailed(){

		$success_data = array(

			//-- add record{{{
			"theme_no" => 1,
			"title" => "test",
			"material" => "saf",
			"record_company" => "adsfas",
			"singers" => "aaa",
			"composers" => "bbbbbbbbb",
			"lyrics" => "dsf",
			"arrangers" => "dsfdsaf",
			"owners" => "dsafdasf",
			//}}}
		);

		$ret = curl_test($this->url,$success_data);
		$real_data = json_decode($ret);

		$err_num = count($real_data);
		if ($err_num > 0)
		{
			echo "ChapterDelActionTest failed!";
		}

		$this->assertEquals($err_num , 0); 	
	}
}

$suite = new PHPUnit_Framework_TestSuite('ChapterDelActionTest');

// Run the tests
$object = $suite->run();
//var_dump($object->failures());

?>


